<?php

	include_once("./global.php");
	session_start();
	if($_SESSION[id]){
		$data = $_POST['appcategory_kid'];
		echo $data;
/*		if($data){*/
			$url = $_SERVER['REQUEST_URI'];
			$url_arr = parse_url($url);
			parse_str($url_arr['query'],$url_arr);
			$url_page = $url_arr[page];
			$keyword = "A_Categoryid = '".$data."'";
			$order = '';
			$condition = new Condition($keyword,$order);
			
			$sql_count = "select * from appinfo {$condition->con()}";
			$query_count = $mysqli->query($sql_count);
			$total = $query_count->num_rows;
			$num = 2;
			$page = new Page($total,$num);
		?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<title>后台首页</title>
<style>
	body{ background:#e7e7e7; margin:0; padding:0;}
	#container{ width:980px; height:auto; position:relative; margin:0 auto;}
	#container #header{ width:980px; height:90px; position:relative; background:#000; line-height:90px;color:#fff; font-size:24px; text-align:center;}
	.left{width:250px; height:auto; position:relative; float:left;}
	.left table{width:248px; height:auto; position:relative; float:left; background:#fff;}
	.left table td{ height:20px; text-align:center;}
	.left table .selected{ background:#73abe3;}
	#content{ width:730px; height:100%; position:relative; float:left; margin:2px 0px;}
	#content .title{ width:720px; height:25px; position:relative; float:left; line-height:25px; font-size:18px; color:#fff; background:#000;}
	form{margin:20px auto; width:720px; height:auto; position:relative; float:left;}
	form .inpuarea{ width:360px; height:150px;}
</style>
</head>
<body>
	<div id="container">
		<div id="header">
			818苹果站后台管理
		</div>
		<div class="left">
			<table>
				<tr><td style="background:#000000; color:#fff;">站点管理</td></tr>
				<tr><td><a href="admin_site_mangerment.php">全局管理</a></td></tr>
				<tr><td>静态页面管理</td></tr>
				<tr><td><a href="admin_link_mangerment.php?page=1">友情链接管理</a></td></tr>
				<tr><td><a href="admin_member_mangerment.php">会员管理</a></td></tr>
				<tr><td><a href="admin_tags_mangerment.php">标签管理</a></td></tr>
				<tr><td><a href="admin_search_mangerment.php">搜索管理</a></td></tr>
			</table>
			<table>
				<tr><td style="background:#000000; color:#fff;">文章管理</td></tr>
				<tr><td><a href="admin_category_mangerment.php">文章分类管理</a></td></tr>
				<tr><td><a href="admin_news_add.php">发布文章</a></td></tr>
				<tr><td><a href="admin_news_mangerment.php">文章管理</a></td></tr>
			</table>
			<table>
				<tr><td style="background:#000000; color:#fff;">应用管理</td></tr>
				<tr><td><a href="admin_appcate_mangerment.php">应用分类管理</a></td></tr>
				<tr><td><a href="admin_app_add.php">添加应用</a></td></tr>
				<tr><td class="selected"><a href="admin_app_mangerment.php">应用管理</a></td></tr>
                <tr><td><a href="admin_app_collection.php">应用采集</a></td></tr>
			</table>
		</div>
	<div id="content">
		<div class="title">APP管理</div>
        <div class="app_category">
        	<div class="category_title">类别</div>
            <?php
            	$sql_appcategory = "select * from appcategoryinfo";
				$query_appcategory = $mysqli->query($sql_appcategory);
				while($result_appcategory = $query_appcategory->fetch_assoc()){
					$kname = $result_appcategory['AC_Categoryname'];
					$kid = $result_appcategory['AC_Categoryid'];
					$sql_keyword = "select * from keywordinfo where K_ID = '$kname'";
					$query_keyword = $mysqli->query($sql_keyword);
					while($result_keyword = $query_keyword->fetch_assoc()){
			?>
						<dt>
                        <form action="judgment.php?page=1" method="post">
                        <input style="display:none;" type="text" name="appcategory_kid" value="<?php echo $kid;?>" />
                        <input type="text" name="appcategory_kname" value="<?php echo $result_keyword['K_Name'];?>" />
                        <input type="submit" name="appcategory_select" value="查询" />
                        </form>
                        </dt>
			<?php
					}
				}
			?>
        </div>
        <table id="<?php echo $data?>">
        	<tr>
            	<td>编号</td>
                <td>标题</td>
                <td>分类</td>
                <td>发布时间</td>
                <td>操作</td>
            </tr>
            <?php
            	$sql_app =$sql_count."{$page->limit_start()}";
				echo $sql_app;
				$query_app = $mysqli->query($sql_app);
				while($result_app = $query_app->fetch_assoc()){
			?>
            <tr>
            	<td><?php echo $result_app['A_Appid']?></td>
                <td><?php echo $result_app['A_Apptrackname']?></td>
                <td><?php echo $result_app['A_Appid']?></td>
                <td><?php echo $result_app['A_Appdate']?></td>
                <td>修改</td>
			</tr>
            <?php
            		}
/*				}else{
					echo "222";
				}*/
			?>
            <tr>
                	<td><?php echo $page->pageFirst();?></td>

                	<td><?php echo $page->pagePre();?></td>

                	<td><?php echo $page->pageList(); ?></td>

                	<td><?php echo $page->pageNext();?></td>

                	<td><?php echo $page->pageLast();?></td>

					<td><?php echo $page->pageTotal();?> </td>               
            </tr>
        </table>
    </div>
<?php 

	}else{
		echo "登录先";
	}



?>